package IO;

import java.io.*;
import java.util.Scanner;

public class PWDemo2 {
    public static void main(String[] args) throws FileNotFoundException {
        Scanner scan = new Scanner(System.in);
        FileOutputStream fos = new FileOutputStream("pw.txt");
        //转换输出流
        OutputStreamWriter osw = new OutputStreamWriter(fos);
        //缓冲字符输出流(高级流)
        BufferedWriter bw = new BufferedWriter(osw);
        //换行输出流
        PrintWriter pw = new PrintWriter(bw,true);



        String str1 = "exit";


        while(true){
            String name = scan.nextLine();
            if(str1.equalsIgnoreCase(name)){
                System.out.println("程序退出");
                break;
            }
            pw.println(name);

        }
        pw.close();








    }
}
